<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" import="java.sql.*" pageEncoding="utf-8"%>
<%@ page import="vo.Customer" %>
<%@page import="vo.Score" %>
<%@page import="dao.ScoreDao" %>
<html>
<head>
<title>页面</title>
<style type="text/css">
/*top*/

body{margin:0 auto;padding:0 auto;text-align: center;width:980px;}

span{font-size:13px;}

table{border:1px dashed white;background: white;}

.content{float: right;top: -180px;position: relative;}

.info{position: relative;top:-250px;}

.div_content table{border:1px solid white;background: white;margin-top: 180px;}/*/////////////////////////////////////////////////////*/

td{border: 1px dashed gray;}

ul, li { list-style:none;}

a{ color:#333; text-decoration:none;}

a:hover{ color:#F00; text-decoration:underline;}

a:active{ color:#30F;}

.nav {margin-top: -10px;margin-left: 10px;}/*////////////////////////////////////////////////*/

.jieshao{float: left;position: relative;left: 200px;}

.nav ul li { float:left;}

.nav ul li a { width:120px; height:40px; text-align:center; line-height:40px; display:block; border-right:2px solid #ccc; background:#eee; color:#666;}

.nav ul li a:hover{ color:#f00;background: #000000;}

.nav ul li ul { position:absolute; display:none;}

.nav ul li ul li { float:none;}

.nav ul li ul li a { border-right:none; border-top:1px dotted #ccc; background:#f5f5f5;}

.nav ul li:hover ul{ display:block; }

.top{margin: 5px auto 0px auto;padding: 0px;width:980px;height:78px;text-align: left;}

.logo{margin-right: 900px;}

.banner{width: 307px;height: 61px;float:left;margin-top: -10px;}

.options{float: right;margin: -20px;}

.home,.shu,.fav{float: leftmargin: 0 16px;padding:0 0 auto auto;display: inline;padding: 0px 0px;margin-right: 20px;}

.home a,.shu a,.fav a{color: #9b9b9b;float: left;margin-left: 15px;margin-top: -10px;}
/*top*/
.content{margin: 80px 0px ; }

h1{ background:black; font-size:14px; height:35px; line-height:35px; padding-right:900px; color:white;margin-top: 80px;}

.fatie{position: relative;left: 230px;color:white;background: black;}

#Methods1{ width:900px;height:110px; background:white;}

#Methods1 dl{margin:0px 10px 0 10px; float:left; border:1px solid white;}

#Methods1 dt{width:180px; margin:10px; height:90px; background:white;}

#Methods1 dd{width:180px; margin:0 0 10px 10px; height:20px; line-height:30px; background:white; text-align:center;}

.td1{margin-top: 0px;}

.td2{margin-top: 0px;}

.td3{margin-top: 0px;}

.td4{margin-top: 0px;}

.td1 .td1_content{float: left;}

.left_info{float: left;}

.img_content{ width:50px;float: left;position: relative;left: 100px;}

.right_info{float: right;position: relative;right:0px;}

.mid_info{float: right; position: relative; right:0px;}

.up{float: left;position: relative;left: 300px;}

.down{float: right;position: relative;right:200px;}

hr{border:1px dashed gray;width: 980px;}

.select1{color:red;}

.select2{color:orange;}

.select3{color:green;}

.select4{color:purple;}

.pinglun{position: absolute;left: -300px;}

.wupinzhuangtai1{color:green;}

.wupinzhuangtai2{color:red;}

.pageNum{position: relative;left: -120px;}

/*nav*/
</style>

</head>
  <body>
 <%@ include file="dengluPublic.jsp" %>
<%@ include file="daohangPublic.jsp"%>
   <h1><font>作品信息</font></h1>
   <div>
   <form action="searchMessage.jsp?num=0" method="post" style="float: left;position: relative;left: 200px;top:-8px;">
   找文章：
   <input type="text" name="xinxi"/><input type="image" value="查找" src="img/search.PNG" onclick="this.form.submit()"/>   
   </form>
   
    <form action="customerPage.jsp" method="post" style="float: left;position: relative;left: 300px;top:-8px;">
   找人：
   <input type="text" name="cno"/><input type="image" value="查找" src="img/search.PNG" onclick="this.form.submit()"/>   
   </form>
   </div>
   <a href="Sciencepublish.jsp"><font class="fatie"><b>我要发帖</b></font></a>
<div id="Methods1">
	<table width="980px"style="position: relative;top:-5px;">
<tr>
	<td>		
		<font class="left_info">"机器换人"呼吁机器人的发展教育</font><img src="img/jiangzuo.png" class="img_content"/><font class="right_info">发布时间2018-4-22</font>
	</td>	
</tr>
<tr>
	<td>		
		<font class="left_info">西安文理关于开展第三个全民国家安全教育日宣传活动的通知</font><img src="img/robot.jpg" class="img_content"/><font class="right_info">发布时间2018-4-22</font>
	</td>	
</tr>
<tr>
	<td>
		<font class="left_info">大学生优质资源共享平台制作团队招新人啦！</font><font class="right_info">发布时间2018-4-22</font>
	</td>	
</tr>
<tr>
	<td>
		<font class="left_info">我院现面向全校学生开展网络基础应用讲座，欢迎同学踊跃报名</font><font class="right_info">发布时间2018-4-22</font>
	</td>	
</tr>
<tr>
	<td>
		<font class="left_info">学姐学长分享STM32的学习经验啦，报名方式在本文章末尾!</font><font class="right_info">发布时间2018-4-22</font>
	</td>	
</tr>
<tr>
	<td>
		<font class="left_info">在"机甲大师"机器人比赛中，我校信工院学生勇夺桂冠</font><font class="right_info">发布时间2018-4-22</font>
	</td>	
</tr>
<tr>
	<td>
		<font class="left_info">学校基建处计划将于明天对学校内的果树喷洒农药，对各位老师学生造成的影响望谅解</font><font class="right_info">发布时间2018-4-22</font>
	</td>	
</tr>
<tr>
	<td>
		<font class="left_info"><a>第一届”创意杯“最佳科技作品评选</a></font><font class="right_info">发布时间2018-4-22</font>
	</td>	
</tr>
<tr>
	<td>
		<font class="left_info">听Dany学姐讲一讲他和KaKa的邂逅</font><font class="right_info">发布时间2018-4-22</font>
	</td>	
</tr>
<%! int i;
String count;
String id;
String wupinzhuangtai;
String message_title;
int num;
int numstore;
int messagecount;
 %>
 <%
 
 String driverClass1="com.mysql.jdbc.Driver";//得到数据库中文章的总条数
	    String url1="jdbc:mysql://localhost:3306/vote?useSSL=false";
	    String user1="root";
	    String password1="womenilu2580";	  	    
	    Class.forName(driverClass1);
	    Connection conn1=DriverManager.getConnection(url1,user1,password1);
	    Statement stat1=conn1.createStatement();	 
	    String sql1="select count(*) as messagecount from science";
	    ResultSet rs1=stat1.executeQuery(sql1);
	    rs1.next();
	    messagecount=Integer.valueOf(rs1.getString("messagecount"));
 request.setCharacterEncoding("utf-8");
 num=Integer.valueOf(request.getParameter("num"));
	numstore=num;
	 if(num>numstore)
	 {	 
	 System.out.println(num);
	 }
	 if(num<numstore)
	 {	 	
	 System.out.println(num);
	 }
 
  %>
		<% 
	  	    
	    Class.forName(driverClass1);
	    Connection conn=DriverManager.getConnection(url1,user1,password1);
	    Statement stat=conn.createStatement();	 
	    String sql="select * from science order by id desc,time desc limit "+num+",5";//吧文章信息从数据库中取出来
	    ResultSet rs=stat.executeQuery(sql);
	    while(rs.next()){	    	 	     
	    message_title=rs.getString("message");
	    String time=rs.getString("time");
	    String img=rs.getString("img");
	    String publisher=rs.getString("publisher");
	    id=rs.getString("id");
	    String select=rs.getString("leixing");	
	    i++;  
	    
	     Class.forName(driverClass1);
	    Connection conn3=DriverManager.getConnection(url1,user1,password1);
	    Statement stat3=conn3.createStatement();	 
	    String sql3="select zhuangtai from science where message='"+message_title+"'";
	    ResultSet rs3=stat3.executeQuery(sql3);
	    while(rs3.next()){
	    wupinzhuangtai=rs3.getString("zhuangtai");	      	  	   
	    }
	     
	    Class.forName(driverClass1);
	    Connection conn2=DriverManager.getConnection(url1,user1,password1);
	    Statement stat2=conn2.createStatement();	 
	    String sql2="select count(*) as count from comment,science where id="+id+" and comment.message=science.message";
	    ResultSet rs2=stat1.executeQuery(sql2);
	    rs2.next();
	    count=rs2.getString("count");
	    System.out.print(count+"///////////////////////////////////");
	    %>
	    <tr>
	    <td>  
	    <font class="left_info"><a href="scienceNews.jsp?id=<%=id %>">[
	    <%
	    	if(select.equals("讲座"))
	    	{
	     %>
	     
	    <font class="select1"><%=select%></font>
	    
	    <%
	   		 }
	   		 else if(select.equals("投票"))
	   		 {
	    %>
	      
	    <font class="select2"><%=select%></font>
	    
	    <%
	   		}
	   		 else if(select.equals("活动"))
	   		 {
	   		 %>
	   		    
	    <font class="select3"><%=select%></font>
	    
	    <%
	   		 }
	   		 else{
	    %>
	    <font class="select4"><%=select%></font>
	    
	    <%
	   		 }
	   		 %>
	    
	    ]
	    <%=message_title %></a></font><img src="<%=img%>" class="img_content"/><font class="mid_info"><font class="pinglun"><a href="scienceNews.jsp?id=<%=id%>">评论(<%=count%>)|
	    <%
	    if(wupinzhuangtai.equals("未借出")){
	     %>
	    	<font class="wupinzhuangtai1"><%=wupinzhuangtai %></font>
	    <%
	    }else{
	     %>
	    	<font class="wupinzhuangtai2"><%=wupinzhuangtai %></font>
	    <%
	    }
	     %>
	    
	    </a></font>发布者：<%=publisher %></font><font class="right_info">发布时间<%=time %>&nbsp;&nbsp;|&nbsp;&nbsp;</font>	   
	    </td>
	    </tr>

	    <%
	    }		
		conn.close();
		%>
		</font><font class="right_info"></font>
	</td>	
</tr>

</table>

<font class="up">
<%if(num>=1) {%>
<a href="science.jsp?num=<%=num-5%>">上一页</a><br />
<%
}
 %>
</font><font class="down">
<font class="pageNum">第<%=num/5+1 %>页</font>
<%
if(num+5<messagecount)
{
 %>
<a href="science.jsp?num=<%=num+5%>">下一页</a>
<%
}
 %>
 </font><br />
<%@ include file="endPublic.jsp" %>
</div>
  </body>
</html>
